/*
 * Copyright (c) 2016- 2020 qolome.com Inc. All Rights Reserved.
 * ProjectName: qolome-knowledge
 * FileName: Editor.java
 * Author: jiangfeng@qolome.com
 * Date: 2020/3/22 下午2:37
 * LastModified: 2020/03/22 14:37:22
 */

package com.qolome.knowledge.design.pattern.memento.editor;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.checkerframework.checker.units.qual.A;

/**
 * @author Qolome
 * @version V1.0
 * @Description 编辑器
 * @date 2020年 03月22日 14:37:20
 */
@AllArgsConstructor
@NoArgsConstructor
@Data
public class Editor {


    private String titile;
    private String content;
    private String imgs;


    public ArticleMemento saveToMemento() {
        ArticleMemento articleMemento = new ArticleMemento(this.titile, this.content, this.imgs);
        return articleMemento;
    }

    public void undoFromMemento(ArticleMemento articleMemento) {

        this.titile = articleMemento.getTitile();
        this.content = articleMemento.getContent();
        this.imgs = articleMemento.getImgs();
    }


}
